<?php
/**
 * User: wufeng
 * Date: 2019/6/10
 * Time: 16:06
 */
namespace app\xcxapi\controller\v1;

use app\common\controller\XcxController;
use app\xcxapi\service\CommonService;

class Commom extends XcxController
{
	/**
	 * 选择客户
	 * User: wufeng
	 * Date: 2020/01/06.
	 */
	public function selectCustomer()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->selectCustomer($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}
	
	/**
	 * User: chenben 
	 * Date: 2020/03/24
	 *
	 * @param $params
	 * @return array
	 */
    public function rollCall()
    {
     	if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->rollCall($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
    }
	
	/**
	 * User: chenben 
	 * Date: 2020/03/26
	 *
	 * @param $params
	 * @return array
	 */
    public function cancleClass()
    {
     	if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->cancleClass($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
    }

	/**
	 * User: chenben 
	 * Date: 2020/03/26
	 *
	 * @param $params
	 * @return array
	 */
    public function deleteClass()
    {
     	if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->deleteClass($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
    }

	/**
	 * 批阅
	 * User: wufeng
	 * Date: 2020/02/20
	 *
	 */
	public function marking()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->marking($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 发起协同
	 * User: wufeng
	 * Date: 2020/02/20
	 *
	 */
	public function pushMessage()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->pushMessage($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 年级、来源、课程顾问
	 * User: wufeng
	 * Date: 2020/02/20
	 *
	 */
	public function dataList()
	{
		if ($this->request->isPost()) {
			$list = (new CommonService($this->type))->dataList();
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 跟进状态/沟通方式
	 * User: wufeng
	 * Date: 2020/02/20
	 *
	 */
	public function followUpLinkUp()
	{
		if ($this->request->isPost()) {
			$list = (new CommonService($this->type))->followUpLinkUp();
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 选择同事
	 * User: wufeng
	 * Date: 2020/02/20
	 *
	 */
	public function selectColleague()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->selectColleague($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 转给同事
	 * User: wufeng
	 * Date: 2020/02/20
	 *
	 */
	public function revolveColleague()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->revolveColleague($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 参与人/提醒时间
	 * User: wufeng
	 * Date: 2020/02/20
	 *
	 */
	public function participantReminderTime()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->participantReminderTime($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 写入跟进
	 * User: wufeng
	 * Date: 2020/02/20
	 *
	 */
	public function writeFollowUpLog()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->writeFollowUpRecord($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 签到页面
	 * User: wufeng
	 * Date: 2020/02/19.
	 */
	public function signInIndex()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->signInIndex($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 签到页面详情
	 * User: wufeng
	 * Date: 2020/03/21
	 *
	 */
	public function signInDetailLists()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->signInDetailLists($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 签到删除
	 * User: wufeng
	 * Date: 2020/03/21
	 *
	 */
	public function signInDel()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->signInDel($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 签到列表
	 * User: wufeng
	 * Date: 2020/02/19.
	 */
	public function signInLists()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->signInLists($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 编辑客户
	 * User: wufeng
	 * Date: 2019/5/28.
	 */
	public function editCustomer()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->editCustomer($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}

	/**
	 * 跟进状态列表
	 * User: wufeng
	 * Date: 2020/04/18
	 *
	 */
	public function followUp()
	{
		if ($this->request->isPost()) {
			$params = $this->request->param();
			$list = (new CommonService($this->type))->followUp($params);
			if (1 !== $list['code']) {
				$this->fail($list);
			}
			$this->win($list);
		}
		$this->fail('ILLEGAL_REQUEST');
	}
}